﻿using Microsoft.SharePoint;

namespace SP.Exporters.Extractors
{
    public class FieldStandardExtractor: IFieldValueExtractor
    {
        public SPField Field { get; set; }

        public FieldStandardExtractor(SPField field)
        {
            Field = field;
        }

        /// <summary>
        /// Gets the field value.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <returns></returns>
        public string GetFieldValue(SPListItem item)
        {
            return Field.GetFieldValueAsText(item[Field.Id]);
        }
    }
}
